Skip to main content

Jsonata queries

Analyze JSON data using the Jsonata queries (https://vason.io/open-query)

The query system enables you to analyze JSON data using the Jsonata language. See JSONata documentation.

Jsonata

Jsonata, similar to SQL in the world of databases, serves as a query language within the realm of JSON:

  • It offers you select, join, aggregate, sort, filter, and other powerful functionalities
  • You can perform updates on JSON effortlessly
  • Conversion of JSON to other JSON structures or alternative text formats becomes feasible.

Examples Jsonata queries

**.extra.velocity /* select nested node key */

$ ~> |**.extra|{"distance": $number(distance) * 1000000}| /* update only part of whole json */

planets[0].name /* select key by index */

planets.extra.{"a": velocity, "b": %.name} /* new json by %parent node */

planets@$P.moons@$M[$M.planet_position=$P.position]{
$P.name: $M.moon
} /* join and group */

User interface

QueryQuery
  1. To open the Query window and analyze JSON from the left panel, click the left Query button or type Alt+Q.
  2. Jsonata queries:
    • In the middle of the Query window, there is a text editor where you can write your own Jsonata queries. Click on the run button or type Ctrl+Enter to execute it.
    • To execute a recent query immediately, simply click on the corresponding item in the recent (history) list. A list of recent queries can be found at the top of the Query window.
  3. See the query result below after executing.